<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<meta charset="utf-8" />
<title></title>
<meta name="description" content="overview & stats" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="static/css/bootstrap.min.css" rel="stylesheet" />
<link href="static/css/bootstrap-responsive.min.css" rel="stylesheet" />
<link rel="stylesheet" href="static/css/font-awesome.min.css" />
<!-- 下拉框 -->
<link rel="stylesheet" href="static/css/chosen.css" />

<link rel="stylesheet" href="static/css/ace.min.css" />
<link rel="stylesheet" href="static/css/ace-responsive.min.css" />
<link rel="stylesheet" href="static/css/ace-skins.min.css" />

<link rel="stylesheet" href="static/css/datepicker.css" />
<!-- 日期框 -->
<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="static/js/jquery.tips.js"></script>

<script type="text/javascript">
	//保存
	function save() {
		if ($("#apply_goods_detail_id").val() == "") {
			$("#apply_goods_detail_id").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#apply_goods_detail_id").focus();
			return false;
		}
		if ($("#apply_goods_id").val() == "") {
			$("#apply_goods_id").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#apply_goods_id").focus();
			return false;
		}
		if ($("#goods_name").val() == "") {
			$("#goods_name").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#goods_name").focus();
			return false;
		}
		if ($("#goods_price").val() == "") {
			$("#goods_price").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#goods_price").focus();
			return false;
		}
		if ($("#goods_num").val() == "") {
			$("#goods_num").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#goods_num").focus();
			return false;
		}
		if ($("#goods_account").val() == "") {
			$("#goods_account").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#goods_account").focus();
			return false;
		}
		if ($("#apply_remark").val() == "") {
			$("#apply_remark").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#apply_remark").focus();
			return false;
		}
		if ($("#reality_num").val() == "") {
			$("#reality_num").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#reality_num").focus();
			return false;
		}
		if ($("#reality_price").val() == "") {
			$("#reality_price").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#reality_price").focus();
			return false;
		}
		if ($("#reality_account").val() == "") {
			$("#reality_account").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#reality_account").focus();
			return false;
		}
		if ($("#reality_remark").val() == "") {
			$("#reality_remark").tips({
				side : 3,
				msg : '请输入',
				bg : '#AE81FF',
				time : 2
			});
			$("#reality_remark").focus();
			return false;
		}
		$("#Form").submit();
		$("#zhongxin").hide();
		$("#zhongxin2").show();
	}
	
	//移除物品
	function removeGoods(obj) {
		var apply_goods_id=$("#apply_goods_id").value;
		var parent=$(obj).parent();//行元素
		var id=parent.attr('id');
		var child=parent.children("span");//兄弟上一个节点元素
		var str=child.html();
		top.jzts();
		var url = "<%=basePath%>
		applygoodsdetail/delete.do?apply_goods_detail_id="
				+ id + "&apply_goods_id=" + apply_goods_id + "&str=" + str;
		$.get(url, function(data) {
			location.reload();
		});
		parent.remove();
	}
</script>
</head>
<body>
	<form action="applygoodsdetail/${msg }.do" name="Form" id="Form"
		method="post">
		<input type="hidden" name="apply_goods_id" id="apply_goods_id"
			value="${pd.apply_goods_id}" />
		<div id="zhongxin">
			<table id="table_report"
				class="table table-striped table-bordered table-hover">
				<tr>
					<td style="width: 70px; text-align: right; padding-top: 13px;">申请人:</td>
					<td><input type="text" value="${pd.USERNAME}"
						title="" readonly="readonly" /></td>
				</tr>
				<tr>
					<td style="width: 70px; text-align: right; padding-top: 13px;">部门:</td>
					<td><input type="text"  value="${pd.department_name}" maxlength="32"
						title="" readonly="readonly" /></td>
				</tr>
				<tr>
					<td style="width: 70px; text-align: right; padding-top: 13px;">申请时间:</td>
					<td><input type="text" value="${pd.create_time}" 
						title="" readonly="readonly" /></td>
				</tr>
				<tr>
					<td style="width: 70px; text-align: right; padding-top: 13px;">物品信息:</td>
					<td><c:choose>
							<c:when test="${not empty detailList}">
								<c:forEach items="${detailList}" var="var" varStatus="vs">
									<div id="${var.apply_goods_detail_id}">
										<span>${vs.index+1}.${var.goods_name}-单价${var.goods_price}-数量<font color="#FF0000">${var.goods_num}</font>-共${var.goods_account}元</span>
										<c:if test="${pd.buy_state==2}">
											<br><span>实际购买-单价${var.reality_price}-数量<font color="#FF0000">${var.reality_num}</font>-共${var.reality_account}元</span>
										</c:if>
										<c:if test="${pd.putin_state==2}">
											<br><span>实际入库数量<font color="#FF0000">${var.put_num}</font></span>
										</c:if>
										<br>
									</div>
								</c:forEach>
							</c:when>
						</c:choose></td>
				</tr>
				<tr>
					<td style="width: 70px; text-align: right; padding-top: 13px;">总金额:</td>
					<td><input type="text" name="goods_account" id="goods_account"
						value="${pd.apply_acount_price}" maxlength="32" placeholder="这里输入"
						title="" readonly="readonly" /></td>
				</tr>
				<tr>
					<td style="width: 70px; text-align: right; padding-top: 13px;">备注:</td>
					<td><input type="text" name="remark" id="remark"
						value="${pd.remark}" maxlength="32" placeholder="" title=""
						readonly="readonly" /></td>
				</tr>
				<tr>
					<td style="width: 70px; text-align: right; padding-top: 13px;">审批状态:</td>
					<td><c:if test="${pd.apply_state==0}">待审批</c:if>
					 <c:if test="${pd.apply_state==1}">同意</c:if> 
					 <c:if test="${pd.apply_state==2}">驳回</c:if>
					 </td>
				</tr>
			</table>
		</div>

		<div id="zhongxin2" class="center" style="display: none">
			<br /> <br /> <br /> <br /> <br /> <img
				src="static/images/jiazai.gif" /><br />
			<h4 class="lighter block green">提交中...</h4>
		</div>

	</form>


	<!-- 引入 -->
	<script type="text/javascript">
		window.jQuery
				|| document
						.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");
	</script>
	<script src="static/js/bootstrap.min.js"></script>
	<script src="static/js/ace-elements.min.js"></script>
	<script src="static/js/ace.min.js"></script>
	<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script>
	<!-- 下拉框 -->
	<script type="text/javascript"
		src="static/js/bootstrap-datepicker.min.js"></script>
	<!-- 日期框 -->
	<script type="text/javascript">
		$(top.hangge());
		$(function() {

			//单选框
			$(".chzn-select").chosen();
			$(".chzn-select-deselect").chosen({
				allow_single_deselect : true
			});

			//日期框
			$('.date-picker').datepicker();
		});
	</script>
</body>
</html>